(function() {"use strict";var __module = CC_EDITOR ? module : {exports:{}};var __filename = 'preview-scripts/assets/game/script/rival.js';var __require = CC_EDITOR ? function (request) {return cc.require(request, require);} : function (request) {return cc.require(request, __filename);};function __define (exports, require, module) {"use strict";
cc._RF.push(module, '455a310SeFHiqMyhHI1dATU', 'rival', __filename);
// game/script/rival.js

"use strict";

var GLB = require("Glb");
// noinspection JSAnnotator
cc.Class({
    extends: cc.Component,
    properties: {
        //小鸟节点与动画
        birdParent: cc.Node,
        yellobird0: cc.Node,
        yellobird1: cc.Node,
        yellobird2: cc.Node,
        yellobird3: cc.Node
    },
    start: function start() {
        cc.director.getScheduler().schedule(this.gameupdatetime, this, 0.01);
    },
    onLoad: function onLoad() {
        this.rivalScore = 0;
        this.Dead = false;
        this.time = 0;
        this.speed = 0;
    },

    init: function init(playerId) {
        this.playerId = playerId;
    },

    update: function update(dt) {

        var timeTmp = this.time + dt;
        this.time = timeTmp;
    },

    gameupdatetime: function gameupdatetime() {
        if (Game.GameManager.gameState !== GameState.Play) {
            return;
        }
        if (this.time > 0.5) {
            if (this.yellobird0.active) {
                this.yellobird0.active = false;
                this.yellobird1.active = true;
            } else if (this.yellobird1.active) {
                this.yellobird1.active = false;
                this.yellobird2.active = true;
            } else if (this.yellobird2.active) {
                this.yellobird2.active = false;
                this.yellobird3.active = true;
            } else if (this.yellobird3.active) {
                this.yellobird3.active = false;
                this.yellobird0.active = true;
            }
            this.time = 0;
        }

        this.speed = this.speed - 0.2;
        this.birdParent.y = this.birdParent.y + this.speed;
        this.birdParent.rotation = -this.speed * 10;
    },

    Gameover: function Gameover() {
        this.Dead = true;
        this.node.active = false;
    },
    jump: function jump(rivalY) {
        this.speed = 5.5;
        this.birdParent.y = rivalY;
    }
});

cc._RF.pop();
        }
        if (CC_EDITOR) {
            __define(__module.exports, __require, __module);
        }
        else {
            cc.registerModuleFunc(__filename, function () {
                __define(__module.exports, __require, __module);
            });
        }
        })();
        //# sourceMappingURL=rival.js.map
        